package com.medical.interrogation.service.impl;

import com.medical.common.security.utils.SecurityUtils;
import com.medical.interrogation.domain.ReceivePatients;
import com.medical.interrogation.mapper.ReceivePatientsMapper;
import com.medical.interrogation.service.ReceivePatientsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ReceivePatientsServiceImpl implements ReceivePatientsService {

    @Autowired
    private ReceivePatientsMapper receivePatientsMapper;


    /**
     * 生成未支付的接诊台数据
     * @param receivePatients
     * @return
     */
    @Override
    public Long receiveInsert(ReceivePatients receivePatients) {
//        Long userId = SecurityUtils.getUserId();
//        receivePatients.setPatientId(userId);
        receivePatientsMapper.receiveInsert(receivePatients);
        Long id = receivePatients.getId();
        System.out.println("获取到的id是：" + id);
        return id;
    }

    /**
     * 接诊台结束更改已接诊
     * @param id
     * @return
     */
    @Override
    public Integer receiveUpdate(Integer id) {
        Integer receiveUpdate = receivePatientsMapper.receiveUpdate(id);
        return receiveUpdate;
    }

    @Override
    public Integer receiveUpd(Integer id) {
        Integer upd = receivePatientsMapper.receiveUpd(id);
        return upd;
    }

    @Override
    public ReceivePatients receiveServiceId(Integer id) {
        ReceivePatients receivePatients = receivePatientsMapper.receiveServiceId(id);
        return receivePatients;
    }
}
